package com.itheima.hello.hellopromax高级进阶.接口;

import java.util.ArrayList;

//第一个实现类
public class studentImpl1 implements studentOp{
    @Override
    public void printAllinfo(ArrayList<student> student) {
        System.out.println("--------------班级成员全部信息-----------");
        for (int i = 0; i < student.size(); i++) {
            System.out.println("姓名:"+ student.get(i).getName() + ",性别:" + student.get(i).getSex() + ",成绩:" + student.get(i).getScore());
        }
        System.out.println("--------------------------------------");
        System.out.println("全班总人数为:" + student.size());
    }

    @Override
    public void printavgscore(ArrayList<student> student) {
        double allscores = 0.0;
        System.out.println("-----------------班级平均分-------------");
        for (int i = 0; i < student.size(); i++) {
            allscores += student.get(i).getScore();}
        double avgscore = allscores / student.size();
        System.out.println("全班的平均分为:" + avgscore);
    }
}
